package com.zonski.jbots.engine;

/**
 * Describes a collision between two objects
 */
public final class Collision
{
    public CollisionData collisionData1;
    public CollisionData collisionData2;
    public Entity entity1;
    public Entity entity2;

    public Collision()
    {
        this(null, new CollisionData(null, 0, 0, 0, 0, 0), null, new CollisionData(null, 0, 0, 0, 0, 0));
    }

    public Collision(Entity entity1, CollisionData data1,
            Entity entity2, CollisionData data2)
    {
        this.entity1 = entity1;
        this.collisionData1 = data1;
        this.entity2 = entity2;
        this.collisionData2 = data2;
    }

    public final CollisionData getCollisionData(Entity entity)
    {
        if(entity == this.entity1)
        {
            return this.collisionData1;
        }else if(entity == this.entity2){
            return this.collisionData2;
        }else{
            return null;
        }
    }
}
